Skip to content

Planning that runs out of time continues at the plan gate, and the plan checks re-plan once - #368

Merged
nambok merged 1 commit into
mainfrom
plan-continues-and-bounded-replans
Oct 29, 2026
Merged

nambok merged 1 commit into
mainfrom
plan-continues-and-bounded-replans

Conversation

@nambok

@nambok nambok commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

A data fix run failed in planning after about 14 minutes with "no work is committed to continue from". It planned, switched repository and planned again there. A release check then read a column the fix writes (updated_at) as removed, and the plan check asked for production and staging proof the plan's claims never needed. A third full plan for one file tag ran out of time. Planning now continues in a fresh step from how far it got, the checks re-plan once in all, and both false positives are fixed.

Changes

  • Planning continues at a plan gate (steps.rs, mod.rs). New Gate::Plan with a PlanState saved on the checkpoint at the start of planning and after every plan, switch and re-plan. It holds the repository and base branch, plan revisions, re-plans, whether a switch happened, whether the checks are done, and the open gaps. On a timeout while planning, the run hands off to a new queue message, which resumes in the settled repository from the run's own plan, or from its own triage when no plan was made yet. Checks it had not finished run then. A new plan revision or fewer open gaps counts as progress. Two planning steps in a row without either stop the run and say where.
  • Re-plans are bounded (MAX_PLAN_REPLANS = 1). A repository switch plans once and never switches again. A file mismatch re-plans only when no switch did. It counts once that plan finishes, so a step that times out during it does the re-plan again rather than skipping it. A plan made in a settled repository puts its file tag check into its one batched send-back, together with the trace, plan judge, feature, outside-work and release gaps. Files that still don't match after that stop the run before any code, as they did before.
  • Open gaps keep every check (plan.rs). After the one send-back, what each check still finds goes on the decision's open gaps. That includes the new-feature gaps. The plan judge used to overwrite the outside-work and release gaps; it now adds to them.
  • Release check flags only real removals (release_plan.rs). A field counts as removed in only two cases: the plan's words or statements remove, drop, rename or unset it, or the plan already has its contract migration. A field listed as both old and new is written, not removed. A migration that only writes values or adds a field needs no release. touches now also reads dropColumn and renameColumn calls. Tests show that UPDATE ... SET updated_at = now(), DELETE FROM ... WHERE updated_at and deleted_at are not removals, and that real drops and renames are still split.
  • env_unproven needs a claim about the environment (plan_judge.rs). An unproven environment counts as a gap only when the decision's cause, data, scope or lookups name it (prod, production and live match each other, as do staging and stage). The judge prompt says the same.
  • Incident case k_plan_time, with its row in docs/incidents.md. It covers a timed-out planning step continuing at the plan gate in the switched repository, stall stops, the bounded re-plans in the pipeline, and a schedule data fix that triggers neither the release split nor environment proof.

Verification

  • cargo fmt --all --check: clean
  • cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo test --workspace: worker 1281 passed, gateway 605, common 1089, plus 2 integration tests; 0 failed
  • New tests: steps::planning_resumes_while_it_makes_progress, steps::plan_state_round_trips_and_bounds_replans, release_plan::writing_a_column_is_not_a_removal, release_plan::a_real_removal_or_rename_is_still_split, plan_judge::an_environment_the_claims_dont_rest_on_needs_no_proof, and the four incidents::k_plan_time cases.

…an checks re-plan once

A data fix run planned, switched repository, planned again, was sent back
by a release check that read a column it writes as removed and by a demand
for production and staging proof, then re-planned for one file tag and ran
out of time: "no work is committed to continue from".

- steps: a new Gate::Plan with a PlanState on the checkpoint (repository,
  base branch, plan revisions, re-plans, switch, checked, open gaps). A
  step that runs out of time while planning hands off to a fresh step that
  resumes from the run's own plan or triage in the settled repository. A
  new plan revision or fewer open gaps is progress; two planning steps in
  a row without it stop the run, saying where.
- Re-plans are bounded to one in all (MAX_PLAN_REPLANS): a switch plans
  once, a file mismatch re-plans only when no switch did, and a plan made
  in a settled repository checks its file tags in its one send-back. What
  each check still finds after that send-back goes on the decision's open
  gaps (the plan check no longer overwrites the others').
- release_plan: only real removals or renames are split. A field counts as
  removed when the plan's words or statements remove, drop, rename or
  unset it, or its contract migration is planned; a migration that writes
  values needs no release. Reads dropColumn and renameColumn calls.
- plan_judge: env_unproven applies only to environments the plan's claims
  (cause, data, scope, lookups) rest on.
- Incident case k_plan_time and its row in docs/incidents.md.
@nambok
nambok force-pushed the plan-continues-and-bounded-replans branch from b954169 to 97480d0 Compare October 29, 2026 20:15
@nambok
nambok merged commit ea1ebf0 into main Oct 29, 2026
9 checks passed
@nambok
nambok deleted the plan-continues-and-bounded-replans branch October 29, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant